﻿Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Text
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls

Namespace DotNetNuke.Modules.ActiveForums.Controls
    <ToolboxData("<{0}:AddThis runat=server></{0}:AddThis>")> _
    Public Class AddThis
        Inherits WebControl
        Private _addThisId As String
        Private _title As String
        Public Property AddThisId() As String
            Get
                Return _addThisId
            End Get
            Set(ByVal value As String)
                _addThisId = value
            End Set
        End Property
        Public Property Title() As String
            Get
                Return _title
            End Get
            Set(ByVal value As String)
                _title = value
            End Set
        End Property
        Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
            Dim sURL As String = HttpContext.Current.Request.RawUrl
            Dim tmp As String = DataCache.GetTemplate("AddThis.txt")
            If Not String.IsNullOrEmpty(AddThisId) Then
                tmp = tmp.Replace("[USERNAME]", AddThisId.Replace("'", "\'"))
                tmp = tmp.Replace("[URL]", sURL)
                tmp = tmp.Replace("[TITLE]", Title.Replace("'", "\'"))
                writer.Write(tmp)
            End If

        End Sub

    End Class

End Namespace
